/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Connexion;

import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import miage.sessions.ecom.remote.EcomAdminRemote;

/**
 *
 * @author Pepito
 */
public class ConnexionAdmin { 
    public static EcomAdminRemote connectionServerBean(){
        EcomAdminRemote connexion = null;
        try {
            System.out.println("connectionServerBean");
            Properties propo = new Properties();
            propo.setProperty("org.omg.CORBA.ORBInitialHost", "localhost"); 
            Context ctx = new InitialContext(propo);
            System.out.println(ctx.getEnvironment());
            connexion = (EcomAdminRemote) ctx.lookup("java:global/ecomProject-ejb/EcomAdmin");
            System.out.println("connexion bean server admin success");
        } catch (NamingException nex) {
            System.out.println(nex.toString());  
        }
        return connexion;
    }
}